﻿@model HdipCricketClub.ViewModels.SelectedPlayersViewModel

@{
    ViewBag.Title = "ReInputTeam";
}

<h2>ReInputTeam</h2>

@using (@Html.BeginForm("SelectPlayers", "SelectTeam", FormMethod.Post))
{
    <fieldset>
        <legend>Fixture:</legend>
        <br />
        @Html.DisplayFor(ModelItem => Model.SelectedFixture.Team.Club.ShortName) @Html.DisplayFor(ModelItem => Model.SelectedFixture.Team.name)
         vs @Html.DisplayFor(ModelItem => Model.SelectedFixture.Opponent.club_name) @Html.DisplayFor(ModelItem => Model.SelectedFixture.Opponent.team_name)<br />
         on @Html.DisplayFor(ModelItem => Model.SelectedFixture.date)<br />
         <br />
         @ViewBag.Message
         <br />
         @Html.HiddenFor(ModelItem => Model.SelectedFixture.fixture_id)
    </fieldset>
    <fieldset>
    <legend>Players Selected:</legend>
    <br />
    @{int i = 1;}
    @foreach (var item in Model.PlayersSelected)
    {
        if (i == 1)
        {   
                @Html.HiddenFor(modelItem => item.member_id)
            <span class="player-one-name">
                @Html.DisplayFor(modelItem => item.FirstAndLastName)
            </span>
            <span class="player-one-select">
                @Html.EditorFor(modelItem => item.Selected)
            </span>
        }
        if (i == 2)
        {   
                @Html.HiddenFor(modelItem => item.member_id)
            <span class="player-two-name">
                @Html.DisplayFor(modelItem => item.FirstAndLastName)
            </span>
            <span class="player-two-select">
                @Html.EditorFor(modelItem => item.Selected)
            </span>
        }
        if (i == 3)
        {   
                @Html.HiddenFor(modelItem => item.member_id)
            <span class="player-three-name">
                @Html.DisplayFor(modelItem => item.FirstAndLastName)
            </span>
            <span class="player-three-select">
                @Html.EditorFor(modelItem => item.Selected)
            </span>
        }
        if (i == 4)
        {   
                @Html.HiddenFor(modelItem => item.member_id)
            <span class="player-four-name">
                @Html.DisplayFor(modelItem => item.FirstAndLastName)
            </span>
            <span class="player-four-select">
                @Html.EditorFor(modelItem => item.Selected)
            </span>
            <br />
            i = 0;
        }
        i++;
    }
    <br />
    </fieldset>
    <br />
    <fieldset>
    <legend>Players Not Selected:</legend>
    <br />
    @{i = 1;}
    @foreach (var item in Model.PlayersNotSelected)
    {
        if (i == 1)
        {   
                @Html.HiddenFor(modelItem => item.member_id)
            <span class="player-one-name">
                @Html.DisplayFor(modelItem => item.FirstAndLastName)
            </span>
            <span class="player-one-select">
                @Html.EditorFor(modelItem => item.Selected)
            </span>
        }
        if (i == 2)
        {   
                @Html.HiddenFor(modelItem => item.member_id)
            <span class="player-two-name">
                @Html.DisplayFor(modelItem => item.FirstAndLastName)
            </span>
            <span class="player-two-select">
                @Html.EditorFor(modelItem => item.Selected)
            </span>
        }
        if (i == 3)
        {   
                @Html.HiddenFor(modelItem => item.member_id)
            <span class="player-three-name">
                @Html.DisplayFor(modelItem => item.FirstAndLastName)
            </span>
            <span class="player-three-select">
                @Html.EditorFor(modelItem => item.Selected)
            </span>
        }
        if (i == 4)
        {   
                @Html.HiddenFor(modelItem => item.member_id)
            <span class="player-four-name">
                @Html.DisplayFor(modelItem => item.FirstAndLastName)
            </span>
            <span class="player-four-select">
                @Html.EditorFor(modelItem => item.Selected)
            </span>
            <br />
            i = 0;
        }
        i++;
    }
    <br />
    </fieldset>
    <p>
        <input type="submit" value="Save" />
    </p>
}
